package com.greedy.bulls.stock.trade.oauth.startup;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: Yanxy
 * @Date: Created in:2023-07-12
 * Description: 启动类
 */
@RestController
@RequestMapping("/trade")
public class TradeUserController {

    @Resource
    private UserDetailsService userDetailsService;

    /**
     * 获取用户信息
     *
     * @param username 用户名
     * @return 用户信息
     */
    @RequestMapping("/user")
    @ResponseBody
    public UserDetails getUser(@RequestParam("username") String username) {
        return userDetailsService.loadUserByUsername(username);
    }
}